// 报表相关api
import { getRequest } from "../baseRequest";
import { ResultData } from "@/api/types";
import { requestHttp } from "@/utils/request";

// 获取表单基础报表信息
export const getFormReportRequest = (params: any) => getRequest("/user/form/report/stats", params);

// 表单收集数
export const getFormSituationRequest = (params: any) => getRequest("/user/form/report/situation", params);
// 表单收集位置
export const getFormPositionRequest = (params: any) => getRequest("/user/form/report/position", params);
// 收集设备
export const getFormDeviceRequest = (params: any) => getRequest("/user/form/report/device", params);
//提交来源
export const getFormSourceRequest = (params: any) => getRequest("/user/form/report/source", params);
//扩展值
export const getFormExtValRequest = (params: any) => getRequest("/user/form/report/extVal", params);
// 选项分析
export const getFormAnalysisRequest = (params: any): Promise<ResultData<AnalysisData[]>> =>
  requestHttp.post("/user/form/report/analysis", params);

// 考试分数分析
export const getFormExamScoreRequest = (params: any) => getRequest("/user/form/report/examScore", params);

export interface AnalysisData {
  type: string;
  label: string;
  optionDataMap: {
    [key: string]: {
      value: number;
      label: string;
      type: string;
      key: string;
    };
  }[];
  chartType: string;
  multiCategory: boolean;
}
